#pragma once
#include "mtxlib.h"

class camera_t
{
	bool m_bFreeMode;
	float m_fViewAngle;
	float m_fW;
	float m_fH;
	float m_fFar;
	float m_fNear;
	float m_fDistance;
	float m_fPhi;
	float m_fTheta;
	vector3 m_Pos;
public:
	enum message_t {LBUTTONDOWN, LBUTTONUP, RBUTTONDOWN, RBUTTONUP, MOUSEMOVE};
	camera_t() : m_fDistance( 6.0f ), m_fPhi( 0.0f ), m_fTheta( 0.0f ), m_bFreeMode(false) {}
	matrix44 getViewMatrix() const;
	matrix44 getProjectionMatrix() const;
	vector3 getPosition() const;
	void setProjection( float viewAngle, float w, float h, float fnear, float ffar );
	void setDistance(float fDist) {m_fDistance = fDist;}
	void setDirection(float fPhi, float fTheta) {m_fPhi = fPhi; m_fTheta = fTheta;}
	void mouseProc( int uMsg, int x, int y );
	void kbdProc(int pressed);
	void switchFreeMode() {m_bFreeMode = !m_bFreeMode;}
};

